<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="UTF-8">
	<title>CRM客户关系管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
 	<!-- <link rel="stylesheet" href="/gaoa/Public/css/global.css" media="all"> -->
	<!--<link rel="stylesheet" href="/gaoa/Public/plugins/font-awesome/css/font-awesome.min.css"> -->

	<link rel="stylesheet" href="/gaoa/Public/css/element-ui--index.css">


	<style>
	    *{
	    	font-family: microsoft YaHei;
	    }
		.pull-left {
			float: left;
		}
		.pull-right {
			float: right;
		}
		.container {
			padding: 2px;
		}
		.container > .wrapp >  .el-row {
			margin-bottom: 10px;
		}
		.el-form--inline .el-form-item {
			margin-bottom: 0px;
		}
/*		#app>.wrapp{
			display: none;
		}*/
		
		/*表格条纹样式*/
		.el-table .info-row {
		background: #ffffff;
		}

		.el-table .positive-row {
		background: #c9e5f5;
		}
		.cell img{
			vertical-align: middle;
		}
		
		.el-date-editor.el-input{
			width: 100%;
			max-width: 370px;
		}

		.el-table__body tr.current-row>td{
	      background: rgba(157, 195, 232, 0.7) !important;
	  }

    @media screen and (min-width:1165px) and (max-width:1200px){
      .el-dialog--small {
          width: 70%;
      }
    }

    @media only screen and (max-width:1164px){
      .el-dialog--small {
          width: 85%;
      }
    }  		
	</style>
	<!-- 如果没有 则 提供一些高级的js功能  -->
	<script src="/gaoa/Public/js/advancejs.js"></script>
	<!-- 不支持IE9 及以下的浏览器 -->
	<!--[if lte IE 9]> 
	<script>
		window.location.href="<?php echo U('login/notsupport');?>";
	</script>
	<![endif]-->
	
</head>
<body>
	
	
  <div id="app" class="container">
    <div class="wrapp" v-show="show" style="display:none">
      <el-row>
        <el-col :span="12">
          <el-form :inline="true" ref="searchForm" :model="searchForm">
            <el-form-item prop="name">
             <el-input placeholder="请输入标题关键字" v-model="searchForm.name"></el-input>
            </el-form-item>
            <el-form-item>
             <el-button type="primary" icon="search" @click="loadDatalist">查询</el-button>
             <el-tooltip content="清空搜索框并刷新表格数据" placement="right">
              <el-button  @click="searchReset" style="margin-left:10px;">重置</el-button>
             </el-tooltip>
            </el-form-item>
          </el-form>
        </el-col>

      </el-row>
      <el-row>
        <el-col :span="24">
          <el-table 
          :data="dataList" 
          v-loading="dataLoad"  
          border  stripe 
          element-loading-text="<?php echo L('DATA_LOGIN');?>" 
          ref="select"
          @row-click="showDetail"
          >
            <!-- <el-table-column type="selection" align="center" width="50"></el-table-column> -->
            <el-table-column label="序号"  :formatter="handleIndex" width="65"></el-table-column>
            <el-table-column label="公告类型" prop="type" align="center" width="150">
               <template scope="scope">
                  {{ getType(scope.row.type, 'NoticeType') }}
               </template>
            </el-table-column>
            <el-table-column label="公告标题" prop="title"></el-table-column>
            <el-table-column label="公告内容(点击查看详细)" prop="content" >
              <template scope="scope">
                {{ scope.row.content | handleString(10) }}
              </template>
            </el-table-column>
            <el-table-column label="开始日期" prop="start" align="center"></el-table-column> 
            <el-table-column label="截止日期" prop="end" align="center"></el-table-column> 
            <el-table-column label="发布人" prop="user"></el-table-column>
            <?php echo $viewDecorator['oprate'];?>
          </el-table>
        </el-col>
      </el-row>

      <el-row type="flex"  justify="space-between" align="middle"  class="row-bg">
            <el-col :span="12">
              <div class="grid-content bg-purple">
                <?php echo $viewDecorator['button'];?>

                 


              </div>
            </el-col>
            <el-col :span="12">
              <div class="grid-content bg-purple-light pull-right">
            <!-- page -->
            <el-pagination
  @current-change="handleCurrentPageChange"
  :current-page="currentPage"
  layout="total, prev, pager, next, jumper"
  :total="total"
  :page-size="pageSize"
  ref="pagination"
  >
</el-pagination>
            <!-- / page -->
              </div>
            </el-col>
      </el-row>
    </div>

    <div class="dialogWrapper" v-show="show" style="display: none">

      <!-- 添加公告 -->
      <el-dialog title="发布公告" v-model="addFormDialog">
<el-form ref="addForm" :rules="addRules" :model="addForm"  :label-width="dialogLabelWidth">
 <el-row>
   <el-col :span="10">
      <el-form-item label="公告标题" prop="title">
        <el-input v-model="addForm.title" placeholder="请填写公告标题"></el-input>
      </el-form-item>
   </el-col>
   <el-col :span="12">
      <el-form-item label="公告类型" prop="type">
        <el-select v-model="addForm.type" placeholder="请选择总结类型">
          <el-option v-for="(value,key) in NoticeType" :label="value" :value="key"></el-option>
        </el-select>
      </el-form-item>
   </el-col>
 </el-row>
 <el-row>
   <el-col :span="20">
     <el-form-item label="公告内容" prop="content">
       <el-input v-model="addForm.content" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请填写公告内容"></el-input>
     </el-form-item>
   </el-col>
 </el-row>
 <el-row>
   <el-col :span="10">
     <el-form-item label="开始日期" prop="start">
        <el-date-picker v-model="addForm.start" type="date" placeholder="请选择开始日期"></el-date-picker>
     </el-form-item>
   </el-col>
   <el-col :span="12">
     <el-form-item label="截止日期" prop="end">
        <el-date-picker v-model="addForm.end" type="date" placeholder="请选择截止日期"></el-date-picker>
     </el-form-item>
   </el-col>
 </el-row>
</el-form>
  <div slot="footer" class="dialog-footer">
     <el-button @click="closeDialog('add')">取 消</el-button>
 <el-button type="primary" v-show="!addFormSubmitStatus" @click="addFormSubmit(page.addFormUrl, 'add')" >确 定</el-button>
 <el-button type="primary" v-show="addFormSubmitStatus" :loading="true" >添加中</el-button>
  </div>
</el-dialog>


      <!-- / 添加公告 -->

      <!-- 编辑 -->
      <el-dialog title="发布公告" v-model="editFormDialog">
<el-form ref="editForm" :rules="addRules" :model="editForm"  :label-width="dialogLabelWidth">
 <el-row>
   <el-col :span="10">
      <el-form-item label="总结标题" prop="title">
        <el-input v-model="editForm.title" placeholder="请填写公告标题"></el-input>
      </el-form-item>
   </el-col>
   <el-col :span="12">
      <el-form-item label="总结类型" prop="type">
        <el-select v-model="editForm.type" placeholder="请选择总结类型">
          <el-option v-for="(value,key) in NoticeType" :label="value" :value="key"></el-option>
        </el-select>
      </el-form-item>
   </el-col>
 </el-row>
 <el-row>
   <el-col :span="20">
     <el-form-item label="公告内容" prop="content">
       <el-input v-model="editForm.content" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请填写公告内容"></el-input>
     </el-form-item>
   </el-col>
 </el-row>
 <el-row>
   <el-col :span="10">
     <el-form-item label="开始日期">
        <el-date-picker v-model="editForm.start" type="date" placeholder="请选择开始日期"></el-date-picker>
     </el-form-item>
   </el-col>
   <el-col :span="12">
     <el-form-item label="截止日期">
        <el-date-picker v-model="editForm.end" type="date" placeholder="请选择截止日期"></el-date-picker>
     </el-form-item>
   </el-col>
 </el-row>
</el-form>
  <div slot="footer" class="dialog-footer">
        <el-button @click="closeDialog('edit')">取 消</el-button>
    <el-button type="primary" v-show="!editFormSubmitStatus" @click="editFormSubmit(page.editFormUrl, 'edit')" >确 定</el-button>
    <el-button type="primary" v-show="editFormSubmitStatus" :loading="true" >修改中</el-button>
  </div>
</el-dialog>


      <!-- / 编辑 -->

      <!-- 编辑 -->
      <el-dialog title="公告内容" v-model="detailFormDialog">
<span>
  {{ detailContent }}
</span>
  <div slot="footer" class="dialog-footer">
    <el-button type="primary" @click="closeDialog('detail')">确 定</el-button>
  </div>
</el-dialog>


      <!-- / 编辑 -->

    </div>

  </div>

	<script src="/gaoa/Public/js/vue.min.js"></script>
  <script src="/gaoa/Public/js/element-ui--index.js"></script>
	<script src="/gaoa/Public/js/vue-resource.min.js"></script>

	<!-- vue 通用部分  -->
	<script src="/gaoa/Public/js/vueHooks.js"></script>
	<script src="/gaoa/Public/js/vueMethods.js"></script>
	<script src="/gaoa/Public/js/vueOption.js"></script>
	<script src="/gaoa/Public/js/vueCommonLogic.js?b=d"></script>
	<script>
		var page = {
			addFormUrl:"<?php echo U('add');?>",
			editFormUrl:"<?php echo U('edit');?>",
			listUrl:"<?php echo U('getList');?>",
			deleteUrl:"<?php echo U('delete');?>",
			pageSize:<?php echo ($pageSize); ?>
		}
		window.defaultOption = new VueOption();

		// setCommonLogin 还可以再细分
		setCommonLogic(window.defaultOption);


	</script>

	<!-- / vue 通用部分  -->


	<script>
		
		
	</script>


	
<script>
  window.defaultOption.setDatas({
    detailContent:"",
    detailFormDialog:false,
    NoticeType:<?php echo json_encode($NoticeType);?>,
    addRules:{
      title:[
         { required: true, message: '请输入公告标题', trigger: 'blur'},
      ],
      type:[
         { required: true, message: '请选择公告类型', trigger: 'blur'},
      ],
      content:[
        {required: true, message: '请输入公告内容', trigger: 'blur'},
      ],
      // start:[
      //   {required: true, message: '请选择开始时间', trigger: 'blur'},
      // ],
      // end:[
      //   {required: true, message: '请选择截止时间', trigger: 'blur'},
      // ],
    }
  }).setForm('search',{
    name:'',
  }).setForm('add',{
    type:'',
    title:'',
    content:'',
    start:'',
    end:'',
  }).setForm('edit',{
    id:"",
    type:'',
    title:'',
    content:'',
    start:'',
    end:'',
  }).setMethod('getType', function(type, field){
     return this[field][type];
  }).setMethod('showDetail', function(row){
    this.detailContent = row.content;
    this.openDialog('detail');
  });
</script>

	<script>
	//改modal

		window.defaultVm = new Vue(window.defaultOption.getOption()).$mount('#app');
	</script>
</body>
</html>